<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="${pageContext.request.contextPath }/public/plugin/layui/css/layui.css">
		<link rel="stylesheet" href="${pageContext.request.contextPath }/public/plugin/validform/css/style.css">
		<script type="text/javascript" src="${pageContext.request.contextPath }/public/plugin/jquery/jquery-1.9.1.min.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath }/public/plugin/artDialog/jquery.artDialog.js?skin=blue"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath }/public/plugin/artDialog/plugins/iframeTools.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath }/public/plugin/validform/Validform_v5.3.2_min.js"></script>
	</head>

	<body>
		<div class="layui-fluid">
			<div class="layui-row" style="margin-bottom: 10px;">
				<span class="layui-breadcrumb">
				  <a href="">系统配置</a>
				  <a href=""><cite>角色管理</cite></a>
				</span>
			</div>

			<form class="layui-form registerform" action="${pageContext.request.contextPath }/admin/role/saveOrUpdate">
			   　　<input type="hidden" name="isUpdate" value="${isUpdate }">
			     <input type="hidden" name="id" value="${m.id }"> 
			     
			   <div class="layui-form-item">
					<label class="layui-form-label">角色名称</label>
					<div class="layui-input-block">
						<input type="text" name="name" value="${m.name }" datatype="*"  nullmsg="角色名称不能为空！"   placeholder="请输入角色名称" class="layui-input">
						<div class="Validform_checktip"></div>
					</div>
				</div>
				
				<div class="layui-form-item">
					<label class="layui-form-label">角色编码</label>
					<div class="layui-input-block">
						<input type="text" name="code" value="${m.code }" datatype="*"  nullmsg="角色 编码不能为空！"   placeholder="请输入角色编码" class="layui-input">
						<div class="Validform_checktip"></div>
					</div>
				</div>
				
				<div class="layui-form-item layui-form-text">
					<label class="layui-form-label">备注</label>
					<div class="layui-input-block">
						<textarea placeholder="请输入内容" name="remark" class="layui-textarea"></textarea>
					</div>
				</div>
	
				<div class="layui-form-item">
					<div class="layui-input-block">
						<button class="layui-btn" id="btn_sub" lay-submit="" lay-filter="demo1">立即提交</button>
						<button type="button" onclick="closeWin()" class="layui-btn layui-btn-primary">关闭</button>
					</div>
				</div>
			</form>

			
		</div>
		<script src="${pageContext.request.contextPath }/public/plugin/layui/layui.all.js"></script>
		<script type="text/javascript">
			//关闭窗口
			function closeWin(){
				art.dialog.close();
			}
			
			$(function(){
				//表单验证，采用异步提交
				$(".registerform").Validform({
					btnSubmit:"#btn_sub", 
					tiptype:function(msg,o,cssctl){
						if(!o.obj.is("form")){//验证表单元素时o.obj为该表单元素，全部验证通过提交表单时o.obj为该表单对象;
							var objtip=o.obj.siblings(".Validform_checktip");
							cssctl(objtip,o.type);
							objtip.text(msg);
						}
					},
					ajaxPost:true,
					callback:function(data){ //提交到服务器后回调的方法
						//返回数据data是json对象，{"info":"demo info","status":"y"}
						//回调父页面方法
						if(data.status==1){
							alert(data.msg);
							//刷新父窗口
							art.dialog.opener.ajaxLoad();
							//关闭窗口
							art.dialog.close();
						}else{
							alert(data.msg);
						}
					
					}
				});
			});

		</script>
	</body>

</html>